<!--
 * @Description: 
 * @Author: ZachGmy
 * @Date: 2022-08-25 15:03:52
 * @LastEditors: HeAo
 * @LastEditTime: 2022-08-25 19:33:03
-->
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <button>跳转页面</button>
  <button>替换页面</button>
  <button>刷新页面</button>
  <button>上一页</button>
  <button>下一页</button>
  <script>
    var btns = document.getElementsByTagName('button')
    // location
    // 跳转页面
    btns[0].onclick = function () {
      location.assign('./03-系统对话框.html')
    }
    // 替换页面 (不能返回上一级)
    btns[1].onclick = function () {
      location.replace('./03-系统对话框.html')
    }
    // 刷新页面
    btns[2].onclick = function () {
      location.reload()
    }

    // history开始
    // 上一页
    btns[3].onclick = function () {
      history.back()
    }
    // 下一页
    btns[4].onclick = function () {
      history.forward()
    }
  </script>
</body>

</html>